<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div id="app">
      {{test}}
      <button v-on:click="add">+</button>
    </div>

    <script src="./js/vue.js"></script>
    <script>
      let app = new Vue({
        el: "#app", //先定义抓取id
        data: {
          counter: 0,
        },
        computed: {
          test() {
            this.con();
            // return this.counter * 2;
          },
        },

        methods: {
          add: function () {
            console.log("adddd");

            this.counter++;
          },
          con() {
            return this.counter * 2;
          },
        },
      });
    </script>
  </body>
</html>
